import request from '@/utils/request'

// 查询订单管理列表
export function listOrder(query) {
  return request({
    url: '/system/order/list',
    method: 'get',
    params: query
  })
}

// 查询订单管理详细
export function getOrder(orderId) {
  return request({
    url: '/system/order/' + orderId,
    method: 'get'
  })
}

// 查询订单状态数量
export function getOrderCount() {
  return request({
    url: '/system/order/statusCount',
    method: 'get'
  })
}

export function getCustomerStatusCount(customerId) {
  return request({
    url: '/system/order/CustomerStatusCount',
    method: 'get',
    params: {customerId}
  })
}

// 获取每日订单统计
export function getDailyOrderCount(dateRange) {
  return request({
    url: '/system/order/dailyOrderCount',
    method: 'get',
    params: { dateRange }
  })
}


// 获取今日销售总额
export function getTodayTotalSales() {
  return request({
    url: '/system/order/todayTotalSales',
    method: 'get'
  })
}

// 获取本周销售总额
export function getThisWeekTotalSales() {
  return request({
    url: '/system/order/thisWeekTotalSales',
    method: 'get'
  })
}

// 获取本月销售总额
export function getThisMonthTotalSales() {
  return request({
    url: '/system/order/thisMonthTotalSales',
    method: 'get'
  })
}

// 获取今日销售订单数量
export function getTodayOrderCount() {
  return request({
    url: '/system/order/getTodayOrderCount',
    method: 'get'
  })
}


// 新增订单管理
export function addOrder(data) {
  return request({
    url: '/system/order',
    method: 'post',
    data: data
  })
}

// 修改订单管理
export function updateOrder(data) {
  return request({
    url: '/system/order',
    method: 'put',
    data: data
  })
}

// 删除订单管理
export function delOrder(orderId) {
  return request({
    url: '/system/order/' + orderId,
    method: 'delete'
  })
}
